<template>
    <div>
        <el-drawer title="" :visible.sync="drawer" :direction="direction" :before-close="handleClose" custom-class="drawer-info">
            <div class="info-item">
                <h5 class="from-title">基本信息</h5>
                <div class="form-item">
                    <label class="form-item-label">会员id:</label>
                    <div class="form-item-content">{{ objInfo.memberIdName }}</div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">真实姓名:</label>
                    <div class="form-item-content">{{ objInfo.realName }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">身份证号:</label>
                    <div class="form-item-content">{{ objInfo.cardNum }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">证件正面照片:</label>
                    <div class="form-item-content" ><img :src="objInfo.imgFront" /></div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">证件背面照片:</label>
                    <div class="form-item-content" ><img :src="objInfo.imgBack" /></div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">出生日期:</label>
                    <div class="form-item-content">{{ objInfo.birthday }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">住址:</label>
                    <div class="form-item-content">{{ objInfo.address }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">证件有效期:</label>
                    <div class="form-item-content">{{ objInfo.validityDate }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">发证机关:</label>
                    <div class="form-item-content">{{ objInfo.issuingAuthority }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">民族:</label>
                    <div class="form-item-content">{{ objInfo.nation }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">性别:</label>
                    <div class="form-item-content">{{ objInfo.gender }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">营业执照类型:</label>
                    <div class="form-item-content">{{ objInfo.cardType }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">法定代表人:</label>
                    <div class="form-item-content">{{ objInfo.person }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">注册资本:</label>
                    <div class="form-item-content">{{ objInfo.capital }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">经营范围:</label>
                    <div class="form-item-content">{{ objInfo.business }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">公司名称:</label>
                    <div class="form-item-content">{{ objInfo.enterpriseName }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">统一社会信用代码:</label>
                    <div class="form-item-content">{{ objInfo.creditCode }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">成立日期:</label>
                    <div class="form-item-content">{{ objInfo.regDate }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">营业期限:</label>
                    <div class="form-item-content">{{ objInfo.businessTerm }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">住所:</label>
                    <div class="form-item-content">{{ objInfo.residence }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">登记机关:</label>
                    <div class="form-item-content">{{ objInfo.regAuthority }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">发证日期:</label>
                    <div class="form-item-content">{{ objInfo.awardDate }}
                    </div>
                </div>
            </div>
        </el-drawer>
    </div>
</template>
<script>
    import { memberrealinfoInfo } from "@/api/member/memberrealinfo.js";
    import { urlList, } from "@/api/public.api.js";
    export default {
        data() {
            return {
                drawer: true,
                direction: "rtl",
                objInfo: {},
                memberIdList:[],
            }
        },
        created() {
        },
        methods: {
          queryUrlList(){
              this.memberIdList = [];
              urlList("/member/member/list").then((resp) => {
                if (resp.code == 0) {
                  if (resp.data) {
                    resp.data.forEach((item) => {
                      this.memberIdList.push({ code: item.id, name: item.nickName });
                    });
                  }
                }
              });
          },
            init(id) {
                this.queryUrlList();
                if (id) {
                   memberrealinfoInfo(id).then(res => {
                        this.objInfo = res.data
                              let memberIdObj = this.memberIdList.find((item) => {
                                return item.code == this.objInfo.memberId;
                              });
                              this.objInfo.memberIdName = memberIdObj ? memberIdObj.name : "";
                   })

                }
                this.drawer = true
            },
            // 关闭抽屉
            handleClose(done) {
                done()
            },
        },
    }
</script>
<style scoped>
    .from-title {
        margin-bottom: 20px;
        padding: 0 20px 20px 20px;
        font-size: 16px;
        color: #17233d;
        border-bottom: 1px solid #eee;
    }
    .info-item {
        margin-bottom: 40px;
    }

    .form-item {
        margin-bottom: 20px;
        font-size: 14px;
    }
    .form-item-label {
        text-align: right;
        float: left;
        width: 25%;
    }
    .form-item-content {
        margin-left: 30%;
        width: 70%;
    }
</style>
